<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
       //转换为字符串
       var num =10;
       console.log(num.toString());
       console.log(String(num));
       console.log(num+'');
       
       //转换为数字型
       var str = '50.21';
       console.log(parseInt(str));
       console.log(parseFloat(str));
       console.log(Number(str));
       console.log(str-0);
       
       //转换为布尔值
       //代表空、否定的值会被转换为false，其他都是true
       // 0,NaN,null,undefined
    </script>
</head>
<body>
    
</body>
</html>